package com.boarsoft.boar.soagov.nexus.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.boarsoft.bean.ReplyInfo;
import com.boarsoft.boar.entity.SoaNexus;
import com.boarsoft.boar.soagov.nexus.NexusBiz;
import com.boarsoft.common.Authorized;
import com.boarsoft.common.dao.PagedResult;

@RestController
@RequestMapping("/nexus")
public class NexusAction {
	@Autowired
	private NexusBiz nexusBiz;

	@RequestMapping("/list.do")
	@Authorized(code = "nexus.list")
	public ReplyInfo<Object> list(String objType0, String objId0, String objType1,
			String objId1, String key, String orderBy, int pageNo, int pageSize) {
		PagedResult<SoaNexus> pr = nexusBiz.list(objType0, objId0, objType1, objId1, key,
				orderBy, pageNo, pageSize);
		return new ReplyInfo<Object>(true, pr);
	}

	@RequestMapping("/save.do")
	@Authorized(code = "nexus.save")
	public ReplyInfo<Object> save(SoaNexus o) {
		nexusBiz.save(o);
		return ReplyInfo.SUCCESS;
	}

	@RequestMapping("/delete.do")
	@Authorized(code = "nexus.delete")
	public ReplyInfo<Object> delete(String id) {
		nexusBiz.delete(id);
		return ReplyInfo.SUCCESS;
	}
}